pkgname=anion-libextl-3-hg
pkgver=12
pkgrel=1
pkgdesc="anion libextl 3"
arch=(i686 x86_64)
url="http://code.google.com/p/anion3/"
license=('GPL2')
makedepends=('mercurial' 'libtu-3')
provides=(libextl libextl-3)
conflicts=(libextl libextl-3)

_hgroot="https://anion3.googlecode.com/hg/"
_hgrepo="anion3"

build() {
  cd "$srcdir"
  msg "Connecting to Mercurial server...."

  if [ -d $_hgrepo ] ; then
    cd $_hgrepo
    hg pull -u || return 1
    msg "The local files are updated."
  else
    hg clone $_hgroot $_hgrepo || return 1
  fi

  msg "Mercurial checkout done or server timeout"
  msg "Starting make..."

  rm -rf "$srcdir/$_hgrepo-build"
  cp -r "$srcdir/$_hgrepo" "$srcdir/$_hgrepo-build"
  cd "$srcdir/$_hgrepo-build"

  #
  # BUILD HERE
  #
  cd anionwm-3/libextl-3
  make LUA_DIR=/usr PREFIX=/usr || return 1
  make LUA_DIR=/usr DESTDIR="$pkgdir/" PREFIX=/usr install || return 1
}
